package edos.prm.util;

import java.util.Date;

/**
 * A utility class representing the time used by process execution
 * schedules.
 * 
 * @version 1.0
 */
public final class Time implements Comparable<Time> {

	private Date time;
	
	/**
	 * Create a Time object based on a furnished date.
	 * 
	 * @param time a Date object on which this Time object is based
	 */
	public Time(Date time) {
		super();
		this.time = time;
	}
	
	public Time(String date) {
		this.time = new Date();
	}

	/**
	 * Create a new time object
	 */
	public Time() {
		this.time = new Date();
	}

	/**
	 * Compare a Time object with this object
	 * 
	 * @param timeObj a Time object
	 * @return -1, 0, or 1 depending on whether timeObj is earlier, equal or
	 * greater than this time.
	 */
	public int compareTo(Time timeObj) {
		return time.compareTo(timeObj.time);
	}

	@Override
	public int hashCode() {
		return time.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		return time.equals(obj);
	}
	
	@Override
	public String toString() {
		return time.toString();
	}
}
